$('#tab_'+type).tabs({
	height: frmHeight-163,
	width: frmWidth-267,
	plain: false,
});

if(type == "identitas_dealer"){
	$('#tab_'+type).tabs('select','Wilayah');
}else if(type == "barang_jasa"){
	$('#tab_'+type).tabs('select','Warna');
}else if(type == "harga_beli"){
	$('#tab_'+type).tabs('select','Harga Beli Unit Motor');
}else if(type == "harga_jual"){
	$('#tab_'+type).tabs('select','Harga Jual Unit Motor');
}

$('#tab_'+type).tabs({
	onSelect: function(title){
		switch(title){		

			//halaman master organoisasi dealer
			case 'Wilayah': 
				_post = [{name:'type', value: 'wilayah'}];		
				$('#master_wilayah').html('');
				$("#master_wilayah").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#master_wilayah').removeClass('loading')
					$('#master_wilayah').html(resp);							
				});	
			break;
			case 'Dealer':
				_post = [{name:'type', value: 'dealer'}];		
				$('#master_dealer').html('');
				$("#master_dealer").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#master_dealer').removeClass('loading')
					$('#master_dealer').html(resp);							
				});	
			break;
			case 'Supplier':
				_post = [{name:'type', value: 'supplier'}];		
				$('#master_supplier').html('');
				$("#master_supplier").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#master_supplier').removeClass('loading')
					$('#master_supplier').html(resp);							
				});	
			break;
			case 'Customer':
				_post = [{name:'type', value: 'customer'}];		
				$('#master_customer').html('');
				$("#master_customer").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#master_customer').removeClass('loading')
					$('#master_customer').html(resp);							
				});	
			break;
			case 'Gudang':
				_post = [{name:'type', value: 'gudang'}];		
				$('#master_gudang').html('');
				$("#master_gudang").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#master_gudang').removeClass('loading')
					$('#master_gudang').html(resp);							
				});	
			break;
			case 'Karyawan':
				_post = [{name:'type', value: 'karyawan'}];		
				$('#master_karyawan').html('');
				$("#master_karyawan").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#master_karyawan').removeClass('loading')
					$('#master_karyawan').html(resp);							
				});	
			break;
			case 'Pihak Ke-III':
				_post = [{name:'type', value: 'pihak'}];		
				$('#master_pihak').html('');
				$("#master_pihak").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#master_pihak').removeClass('loading')
					$('#master_pihak').html(resp);							
				});	
			break;
			case 'Kas':
				_post = [{name:'type', value: 'kas'}];		
				$('#master_kas').html('');
				$("#master_kas").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#master_kas').removeClass('loading')
					$('#master_kas').html(resp);							
				});	
			break;
			case 'Aktiva Tetap':
				_post = [{name:'type', value: 'aktiva'}];		
				$('#master_aktiva').html('');
				$("#master_aktiva").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#master_aktiva').removeClass('loading')
					$('#master_aktiva').html(resp);							
				});	
			break;
			

			//halaman master barang dan jasa
			case 'Warna':
				_post = [{name:'type', value: 'warna'}];		
				$('#master_warna').html('');
				$("#master_warna").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#master_warna').removeClass('loading')
					$('#master_warna').html(resp);							
				});	
			break;
			case 'Unit Motor':
				_post = [{name:'type', value: 'motor'}];		
				$('#master_motor').html('');
				$("#master_motor").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#master_motor').removeClass('loading')
					$('#master_motor').html(resp);							
				});	
			break;
			case 'Spare Part':
				_post = [{name:'type', value: 'sparepart'}];		
				$('#master_sparepart').html('');
				$("#master_sparepart").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#master_sparepart').removeClass('loading')
					$('#master_sparepart').html(resp);							
				});	
			break;
			case 'Generator':
				_post = [{name:'type', value: 'generator'}];		
				$('#master_generator').html('');
				$("#master_generator").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#master_generator').removeClass('loading')
					$('#master_generator').html(resp);							
				});	
			break;
			case 'Service':
				_post = [{name:'type', value: 'service'}];		
				$('#master_service').html('');
				$("#master_service").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#master_service').removeClass('loading')
					$('#master_service').html(resp);							
				});	
			break;
			case 'Peralatan Service':
				_post = [{name:'type', value: 'peralatan_service'}];		
				$('#master_peralatanservice').html('');
				$("#master_peralatanservice").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#master_peralatan_service').removeClass('loading')
					$('#master_peralatan_service').html(resp);							
				});	
			break;
			case 'Barang Promosi':
				_post = [{name:'type', value: 'barang_promosi'}];		
				$('#master_barangpromosi').html('');
				$("#master_barangpromosi").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#master_barang_promosi').removeClass('loading')
					$('#master_barang_promosi').html(resp);							
				});	
			break;


			//halaman master proses
			case 'Proses Promosi Unit Motor':
				_post = [{name:'type', value: 'proses_promosi_unit'}];		
				$('#master_proses_promosi_unit').html('');
				$("#master_proses_promosi_unit").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#master_proses_promosi_unit').removeClass('loading')
					$('#master_proses_promosi_unit').html(resp);							
				});	
			break;
			case 'Proses Promosi Service':
				_post = [{name:'type', value: 'proses_promosi_service'}];		
				$('#master_proses_promosi_service').html('');
				$("#master_proses_promosi_service").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#master_proses_promosi_service').removeClass('loading')
					$('#master_proses_promosi_service').html(resp);							
				});	
			break;
			case 'Proses Promosi Spare Part':
				_post = [{name:'type', value: 'proses_promosi_sparepart'}];		
				$('#master_proses_promosi_sparepart').html('');
				$("#master_proses_promosi_sparepart").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#master_proses_promosi_sparepart').removeClass('loading')
					$('#master_proses_promosi_sparepart').html(resp);							
				});	
			break;
			case 'Proses BBN Unit Motor':
				_post = [{name:'type', value: 'proses_bbn_unit'}];		
				$('#master_proses_bbn_unit').html('');
				$("#master_proses_bbn_unit").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#master_proses_bbn_unit').removeClass('loading')
					$('#master_proses_bbn_unit').html(resp);							
				});	
			break;
			case 'Proses Pembiayaan Unit Motor':
				_post = [{name:'type', value: 'proses_pembiayaan_unit'}];		
				$('#master_proses_pembiayaan_unit').html('');
				$("#master_proses_pembiayaan_unit").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#master_proses_pembiayaan_unit').removeClass('loading')
					$('#master_proses_pembiayaan_unit').html(resp);							
				});	
			break;
			case 'Proses Service KSG':
				_post = [{name:'type', value: 'proses_service_ksg'}];		
				$('#master_proses_service_ksg').html('');
				$("#master_proses_service_ksg").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#master_proses_service_ksg').removeClass('loading')
					$('#master_proses_service_ksg').html(resp);							
				});	
			break;
			
			//halaman master akutansi
			case 'Kode Akun':
				_post = [{name:'type', value: 'kode_akun'}];		
				$('#master_kode_akun').html('');
				$("#master_kode_akun").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#master_kode_akun').removeClass('loading')
					$('#master_kode_akun').html(resp);							
				});	
			break;
			case 'Akun Kas':
				_post = [{name:'type', value: 'akun_kas'}];		
				$('#master_akun_kas').html('');
				$("#master_akun_kas").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#master_akun_kas').removeClass('loading')
					$('#master_akun_kas').html(resp);							
				});	
			break;
			case 'Akun Barang & Jasa':
				_post = [{name:'type', value: 'akun_barang_jasa'}];		
				$('#master_akun_barang_jasa').html('');
				$("#master_akun_barang_jasa").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#master_akun_barang_jasa').removeClass('loading')
					$('#master_akun_barang_jasa').html(resp);							
				});	
			break;
			case 'Akun Aktiva Tetap By Dealer':
				_post = [{name:'type', value: 'akun_aktifa_tetap'}];		
				$('#master_akun_aktifa_tetap').html('');
				$("#master_akun_aktifa_tetap").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#master_akun_aktifa_tetap').removeClass('loading')
					$('#master_akun_aktifa_tetap').html(resp);							
				});	
			break;
			case 'Akun Saldo By Dealer':
				_post = [{name:'type', value: 'akun_saldo'}];		
				$('#master_akun_saldo').html('');
				$("#master_akun_saldo").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#master_akun_saldo').removeClass('loading')
					$('#master_akun_saldo').html(resp);							
				});	
			break;



			/*case 'Harga Beli Unit Motor':
				_post = [{name:'type', value: 'harga_belimotor'}];		
				$('#harga_beli_motor').html('');
				$("#harga_beli_motor").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#harga_beli_motor').removeClass('loading')
					$('#harga_beli_motor').html(resp);							
				});	
			break;
			case 'Harga Beli Peralatan Service':
				_post = [{name:'type', value: 'harga_beliperalatanservice'}];		
				$('#harga_beli_peralatanservice').html('');
				$("#harga_beli_peralatanservice").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#harga_beli_peralatanservice').removeClass('loading')
					$('#harga_beli_peralatanservice').html(resp);							
				});	
			break;
			case 'Harga Beli Spare Part':
				_post = [{name:'type', value: 'harga_belisparepart'}];		
				$('#harga_beli_sparepart').html('');
				$("#harga_beli_sparepart").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#harga_beli_sparepart').removeClass('loading')
					$('#harga_beli_sparepart').html(resp);							
				});	
			break;
			case 'Harga Beli Generator':
				_post = [{name:'type', value: 'harga_beligenerator'}];		
				$('#harga_beli_generator').html('');
				$("#harga_beli_generator").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#harga_beli_generator').removeClass('loading')
					$('#harga_beli_generator').html(resp);							
				});	
			break;
			/*
			case 'Harga Beli Barang Promosi':
				_post = [{name:'type', value: 'harga_belibarangpromosi'}];		
				$('#harga_beli_barangpromosi').html('');
				$("#harga_beli_barangpromosi").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#harga_beli_barangpromosi').removeClass('loading')
					$('#harga_beli_barangpromosi').html(resp);							
				});	
			break;
			*/
			
			
			/*case 'Harga Jual Unit Motor':
				_post = [{name:'type', value: 'harga_jualmotor'}];		
				$('#harga_jual_motor').html('');
				$("#harga_jual_motor").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#harga_jual_motor').removeClass('loading')
					$('#harga_jual_motor').html(resp);							
				});	
			break;
			case 'Harga Jasa Service':
				_post = [{name:'type', value: 'harga_jasaservice'}];		
				$('#harga_jasa_service').html('');
				$("#harga_jasa_service").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#harga_jasa_service').removeClass('loading')
					$('#harga_jasa_service').html(resp);							
				});	
			break;
			case 'Harga Jual Spare Part':
				_post = [{name:'type', value: 'harga_jualsparepart'}];		
				$('#harga_jual_sparepart').html('');
				$("#harga_jual_sparepart").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#harga_jual_sparepart').removeClass('loading')
					$('#harga_jual_sparepart').html(resp);							
				});	
			break;
			case 'Harga Jual Generator':
				_post = [{name:'type', value: 'harga_jualgenerator'}];		
				$('#harga_jual_generator').html('');
				$("#harga_jual_generator").addClass("loading");
				$.post(host+'master/gettab/', _post, function(resp) {
					$('#harga_jual_generator').removeClass('loading')
					$('#harga_jual_generator').html(resp);							
				});	
			break;*/
			
		}
	}
});
